package com.tencent.qplus.paddata.util;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class JdbcUtils {
	public static void release(Statement st){
		try {
			if(st!=null && !st.isClosed()){
				st.close();
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	
	
	public static void release(PreparedStatement pst){
		try {
			if(pst!=null && !pst.isClosed()){
				pst.close();
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	
	public static void release(ResultSet rs){
		try {
			if(rs!=null && !rs.isClosed()){
				rs.close();
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	
	public static void release(Connection conn){
		try {
			if(conn!=null && !conn.isClosed()){
				conn.close();
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

}
